package com.hzit.service.impl;

import com.hzit.entity.Classes;
import com.hzit.mapper.ClassesMapper;
import com.hzit.service.ClassesService;
import com.hzit.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import java.io.IOException;
import java.util.List;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
public class ClassesServiceImpl implements ClassesService {

	//1. 查询所有班级
	@Override
	public List<Classes> findAll() {
		try(SqlSession sqlSession = MybatisUtil.sqlSessionFactory().openSession()){
			ClassesMapper mapper = sqlSession.getMapper(ClassesMapper.class);
			return mapper.findAll();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}
}
